package com.wsb.wetchat.advice;

import com.wsb.wetchat.exption.BussinesExpetion;
import com.wsb.wetchat.model.CommonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author wang shaobo
 * @date 2022/6/20  19:36
 */
@ControllerAdvice
public class ExpectionHandler {


    @ExceptionHandler(BussinesExpetion.class)
    @ResponseBody
    public CommonResult handleEx(BussinesExpetion e){


        return new CommonResult(e.getCode(),e.getMessage(),"异常");
    }

}
